desYG <- df[df$survey == "YouGov", c(
  "ipl12s", "ipl24s", "psy12s", "psy24s", "connectionHc", "outsider", "futureHc",
  "isolation", "ling12s", "ling24s", "read", "speak", "write", "listen", "econ12s",
  "econ24s", "income", "employment3cat", "expenses", "emplSatisfied", "pol12s",
  "pol24s", "polUnderstanding", "polDiscuss", "polQuiz", "polAction", "soc12s",
  "soc24s", "dinner", "contactsInUsCat2", "maxOrg", "favors", "nav12s", "nav24s",
  "seeDoctor", "findJobs", "legalProblems", "AdDTM", "gender", "yschoolingStd",
  "ageStd", "yearsInStd", "sharedL"
)]

desGer <- df[df$survey == "Germany", c(
  "ipl12s", "ipl24s", "psy12s", "psy24s", "connectionHc", "outsider", "futureHc",
  "isolation", "ling12s", "ling24s", "read", "speak", "write", "listen", "econ12s",
  "econ24s", "income", "employment3cat", "expenses", "emplSatisfied", "pol12s",
  "pol24s", "polUnderstanding", "polDiscuss", "polQuiz", "polAction", "soc12s",
  "soc24s", "dinner", "contactsInUsCat2", "maxOrg", "favors", "nav12s", "nav24s",
  "seeDoctor", "findJobs", "legalProblems", "AdDTM", "gender", "yschoolingStd",
  "ageStd", "yearsInStd", "sharedL"
)]

desNY <- df[df$survey == "NewYork", c(
  "ipl12s", "ipl24s", "psy12s", "psy24s", "connectionHc", "outsider", "futureHc",
  "isolation", "ling12s", "ling24s", "read", "speak", "write", "listen", "econ12s",
  "econ24s", "income", "employment3cat", "expenses", "emplSatisfied", "pol12s",
  "pol24s", "polUnderstanding", "polDiscuss", "polQuiz", "polAction", "soc12s",
  "soc24s", "dinner", "contactsInUsCat2", "maxOrg", "favors", "nav12s", "nav24s",
  "seeDoctor", "findJobs", "legalProblems", "AdDTM", "gender", "yschoolingStd",
  "ageStd", "yearsInStd", "sharedL"
)]

desAllies <- df[df$survey == "Allies", c(
  "ipl12s", "ipl24s", "psy12s", "psy24s", "connectionHc", "outsider", "futureHc",
  "isolation", "ling12s", "ling24s", "read", "speak", "write", "listen", "econ12s",
  "econ24s", "income", "employment3cat", "expenses", "emplSatisfied", "pol12s",
  "pol24s", "polUnderstanding", "polDiscuss", "polQuiz", "polAction", "soc12s",
  "soc24s", "dinner", "contactsInUsCat2", "maxOrg", "favors", "nav12s", "nav24s",
  "seeDoctor", "findJobs", "legalProblems", "AdDTM", "gender", "yschoolingStd",
  "ageStd", "yearsInStd", "sharedL"
)]

names(desYG) <- c("IPL-12", "IPL-24", "Psy. Int. 12", "Psy. Int. 24", "Connectedness", 
                  "Outsider", "Future", "Isolated", "Ling. Int. 12", "Ling. Int. 24", "Read",
                  "Speak", "Write", "Listen", "Econ. Int. 12", "Econ. Int. 24", "Income", 
                  "Employment", "Expenses", "Empl. Satisfaction", "Pol. Int. 12", 
                  "Pol. Int. 24", "Understanding", "Discuss", "Pol. Quiz", "Pol. Action", 
                  "Soc. Int. 12", "Soc. Int. 24", "Dinner", "Contacts", "Organizations", 
                  "Favors", "Nav. Int. 12", "Nav. Int. 24", "Doctor", "Jobs", "Legal", "Nav. Quiz",
                  "Female", "Schooling", "Age", "Residency", "Shared Language")

names(desGer) <- c("IPL-12", "IPL-24", "Psy. Int. 12", "Psy. Int. 24", "Connectedness", 
                   "Outsider", "Future", "Isolated", "Ling. Int. 12", "Ling. Int. 24", "Read",
                   "Speak", "Write", "Listen", "Econ. Int. 12", "Econ. Int. 24", "Income", 
                   "Employment", "Expenses", "Empl. Satisfaction", "Pol. Int. 12", 
                   "Pol. Int. 24", "Understanding", "Discuss", "Pol. Quiz", "Pol. Action", 
                   "Soc. Int. 12", "Soc. Int. 24", "Dinner", "Contacts", "Organizations", 
                   "Favors", "Nav. Int. 12", "Nav. Int. 24", "Doctor", "Jobs", "Legal", "Nav. Quiz",
                   "Female", "Schooling", "Age", "Residency", "Shared Language")

names(desNY) <- c("IPL-12", "IPL-24", "Psy. Int. 12", "Psy. Int. 24", "Connectedness", 
                  "Outsider", "Future", "Isolated", "Ling. Int. 12", "Ling. Int. 24", "Read",
                  "Speak", "Write", "Listen", "Econ. Int. 12", "Econ. Int. 24", "Income", 
                  "Employment", "Expenses", "Empl. Satisfaction", "Pol. Int. 12", 
                  "Pol. Int. 24", "Understanding", "Discuss", "Pol. Quiz", "Pol. Action", 
                  "Soc. Int. 12", "Soc. Int. 24", "Dinner", "Contacts", "Organizations", 
                  "Favors", "Nav. Int. 12", "Nav. Int. 24", "Doctor", "Jobs", "Legal", "Nav. Quiz",
                  "Female", "Schooling", "Age", "Residency", "Shared Language")

names(desAllies) <- c("IPL-12", "IPL-24", "Psy. Int. 12", "Psy. Int. 24", "Connectedness", 
                      "Outsider", "Future", "Isolated", "Ling. Int. 12", "Ling. Int. 24", "Read",
                      "Speak", "Write", "Listen", "Econ. Int. 12", "Econ. Int. 24", "Income", 
                      "Employment", "Expenses", "Empl. Satisfaction", "Pol. Int. 12", 
                      "Pol. Int. 24", "Understanding", "Discuss", "Pol. Quiz", "Pol. Action", 
                      "Soc. Int. 12", "Soc. Int. 24", "Dinner", "Contacts", "Organizations", 
                      "Favors", "Nav. Int. 12", "Nav. Int. 24", "Doctor", "Jobs", "Legal", "Nav. Quiz",
                      "Female", "Schooling", "Age", "Residency", "Shared Language")




stargazer(desYG,  
          summary.stat = c("n", "median", "mean", "sd", "p25", "p75"), 
          digits = 2,
          align = TRUE,
          title = "Descriptive statistics for Sample A",
          notes = c("Aggregates rescaled to 0-1 range, individual variables range from 1 to 5. ",
                    "Schooling, Age, and Residency are coded in standard deviations of the pooled data.",
                    "SD Schooling = 5.22y, SD Age = 17.55y, SD Residency = 18.98y"),
          out = c(here::here("Draft/PNAS/draft/tables", "desYG.tex")))

stargazer(desGer,  
          summary.stat = c("n", "median", "mean", "sd", "p25", "p75"), 
          digits = 2,
          align = TRUE,
          title = "Descriptive statistics for Sample B",
          notes = c("Aggregates rescaled to 0-1 range, individual variables range from 1 to 5. ",
                    "Schooling, Age, and Residency are coded in standard deviations of the pooled data.",
                    "SD Schooling = 5.22y, SD Age = 17.55y, SD Residency = 18.98y"),
          out = c(here::here("Draft/PNAS/draft/tables", "desGer.tex")))

stargazer(desNY,  
          summary.stat = c("n", "median", "mean", "sd", "p25", "p75"), 
          digits = 2,
          align = TRUE,
          title = "Descriptive statistics for Sample C",
          notes = c("Aggregates rescaled to 0-1 range, individual variables range from 1 to 5. ",
                    "Schooling, Age, and Residency are coded in standard deviations of the pooled data.",
                    "SD Schooling = 5.22y, SD Age = 17.55y, SD Residency = 18.98y"),
          out = c(here::here("Draft/PNAS/draft/tables", "desNY.tex")))

stargazer(desAllies,  
          summary.stat = c("n", "median", "mean", "sd", "p25", "p75"), 
          digits = 2,
          align = TRUE,
          title = "Descriptive statistics for Sample D",
          notes = c("Aggregates rescaled to 0-1 range, individual variables range from 1 to 5. ",
                    "Schooling, Age, and Residency are coded in standard deviations of the pooled data.",
                    "SD Schooling = 5.22y, SD Age = 17.55y, SD Residency = 18.98y"),
          out = c(here::here("Draft/PNAS/draft/tables", "desAllies.tex")))
